<template>
  <div>
    <router-view />
    <div class="btm" id="btm"></div>
    <van-tabbar v-model="active" class="tabbar" id="tabbar">
      <van-tabbar-item name="Home" icon="home-o" to="/home">首页</van-tabbar-item>
      <van-tabbar-item name="News" icon="comment-o" dot to="/news">消息</van-tabbar-item>
      <van-tabbar-item name="Mine" icon="manager-o" to="/mine">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import { onMounted, ref } from "vue";
import $router from "../router/index";
export default {
  name: "Homes",
  setup() {
    let routername = $router.currentRoute.value.name;
    const active = ref(routername);
    onMounted(() => {
      const tabbar = document.getElementById("tabbar");
      const btm = document.getElementById("btm");
      setTimeout(() => {
        btm.style.height = tabbar.clientHeight + "px";
      }, 300);
    });
    return { active };
  },
};
</script>

<style lang="scss" scoped>
</style>